<script lang="ts" setup name="HomeHot">
import HomePanel from './home-panel.vue'
import useStore from '@/store'
import { useLazyData } from '@/utils/hooks'
import HomeSkeleton from './home-skeleton.vue'
const { home } = useStore()
const target = useLazyData(home.getHotGoodsList)
</script>
<template>
  <div class="home-new" ref="target">
    <HomePanel title="人气推荐" sub-title="人气爆款 不容错过">
      <!-- 面板内容 -->
      <Transition name="fade">
        <ul class="goods-list" v-if="home.hotGoodsList.length">
          <li v-for="item in home.hotGoodsList" :key="item.id">
            <RouterLink :to="`/goods/${item.id}`">
              <img v-lazy="item.picture" />
              <p class="name ellipsis">{{ item.title }}</p>
              <p class="desc">&yen;{{ item.alt }}</p>
            </RouterLink>
          </li>
        </ul>
        <HomeSkeleton v-else></HomeSkeleton>
      </Transition>
    </HomePanel>
  </div>
</template>

<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .desc {
      color: #999;
      font-size: 18px;
    }
  }
}
</style>
